
function updateOneInfo(num,info_id,pub_date) { 
		document.getElementById('updateThisInfo'+num).innerHTML = '<img src="/program/admin/images/wait.gif"/>';
		jQuery.ajax( {
			   type: 'POST',
			   url: 'updateOneInfo.jsp',
			   data: 'info_id='+info_id+'&pub_date='+pub_date+'&num='+num,
			   success: function(msg){
					document.getElementById('updateThisInfo'+num).innerHTML=msg;
				 }
			}); 
	}
	
function trim(str){
    return str.replace(/(^\s*)|(\s*$)/g,"");
}//去掉空格









function checkSub(){
	
	if(document.getElementById('class_attr').value==''){
		alert('请选择所属分类');
		document.getElementById('class_attr').focus();
		return false;
	}
	
	if(document.getElementById('title').value==''){
		alert('请输入知识标题');
		document.getElementById('title').focus();
		return false;
	}

	
	var str=CKEDITOR.instances.content.getData();
		str = trim(str);
	if(str=="")
		{
    	alert('请输入知识内容');
    	CKEDITOR.instances.content.focus();
		return false;
		}
		
	
	document.addForm.submit();
}

function search(){
	//TODO
	document.indexForm.submit();
}

function ChangeClassStyle(){
	document.getElementById("class_attr").value = '';
	document.getElementById("classId1").style.display = 'none';
	document.getElementById("classId2").style.display = 'block';
}


var type = '5';

var fectureArray=new Array();
fectureArray=['请选择'];


function setSecondClass(val) {
	if(document.getElementById('sort1').value == ''){
		document.getElementById('sort2').style.display = 'none';
		document.getElementById('sort3').style.display = 'none';
		document.getElementById('sort1').value = '';
		document.getElementById('sort2').value = '';
		document.getElementById('sort3').value = '';
	}else{
		Ts_categoryInfo.getCatClassByUpId(val, type, setSort2);
	}
}

function setSort2(map_data) {

	var up_class_id = document.getElementById('sort1').value;
	if (map_data != null) {
		Ts_categoryInfo.checkCatSonById(up_class_id,function(ret){
		 if(ret == '1'){
		 }else{
		 	 	DWRUtil.removeAllOptions('sort2');
				DWRUtil.addOptions('sort2',fectureArray);
				DWRUtil.addOptions('sort2', map_data);
				var item = document.getElementById('sort2').length;
				if (item == 0) {
					document.getElementById('sort2').style.display = 'none';
				} else {
					document.getElementById('sort2').style.display = 'inline';
				}
		 }
	 });
	}
}

function setTherdClass(val) {

	Ts_categoryInfo.getCatClassByUpId(val, type, setSort3);
}

function setSort3(map_data) {

	var up_class_id = document.getElementById('sort2').value;

	if (map_data != null) {
		Ts_categoryInfo.checkCatSonById(up_class_id,function(ret){
		 if(ret == '1'){
		 }else{
		 	 	DWRUtil.removeAllOptions('sort3');
				DWRUtil.addOptions('sort3',fectureArray);
				DWRUtil.addOptions('sort3', map_data);
				var item = document.getElementById('sort3').length;
				if (item == 0) {
					document.getElementById('sort3').style.display = 'none';
				} else {
					document.getElementById('sort3').style.display = 'inline';
				}
		 }
	 });
	}
}